package o_applet;
// ----------------------------------------------------
// 파일을 읽어서 웹브라우져의 textarea에 표시한다.
// date : 2006
// make : pwg
// ----------------------------------------------------

import java.applet.*;
import java.awt.*;
import java.io.*;

public class RandomAccessFileRead extends Applet
{
	TextArea text;
	public void init()
	{
	}
	
	public void start()
	{
		RandomAccessFileReadSub fr = new RandomAccessFileReadSub();
		text = new TextArea(20,40);
		this.add(text);
		
		text.append(fr.read());

	}
	
}

class RandomAccessFileReadSub
{
	String fileName;
	RandomAccessFile file;
	
	String param="FileFind.java";
	
	public RandomAccessFileReadSub()
	{
	}

	public String read()
	{
		byte b[];
		long length=0;
		

		//param = this.getParameter("fileName");
		try
		{
			file = new RandomAccessFile(param,"r");
			length = file.length();
			b = new byte[(int)length];
			file.read(b,0,(int)length);
	
			 return new String(b);
	
		}catch(Exception ex){
			return "error:"+ex.toString();
		}		
		
	}
	
}